package com.itheima.config;


import com.alibaba.druid.DruidRuntimeException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@Slf4j
@Configuration
public class ConfigDataSource {
    @Lazy
//    @Scope("prototype")
    @Bean
    public List<DruidRuntimeException> getDataSource(){
        System.out.println(new DruidRuntimeException());
        DruidRuntimeException bean1 = new DruidRuntimeException("汤云鹤");
        DruidRuntimeException bean2 = new DruidRuntimeException("汤云鹤");
        DruidRuntimeException bean3 = new DruidRuntimeException("汤云鹤");
        ArrayList<DruidRuntimeException> druidRuntimeExceptions = new ArrayList<>();
        Collections.addAll(druidRuntimeExceptions,bean1,bean2,bean3);
        return druidRuntimeExceptions;

    }



}

